<?php
// CLI     
// : php tools/device_tcp/voice_cli_test.php success|end|duplicate

require_once __DIR__ . '/simple_server.php';

$type = strtolower($argv[1] ?? '');
if (!in_array($type, ['success','end','duplicate'], true)) {
    fwrite(STDERR, "Usage: php tools/device_tcp/voice_cli_test.php success|end|duplicate\n");
    exit(2);
}

try {
    echo "Playing: {$type}\n";
    playVoice($type);
    echo "Done.\n";
} catch (Throwable $e) {
    fwrite(STDERR, "Error: " . $e->getMessage() . "\n");
    exit(1);
}

